﻿using Ndns.ConsoleLogger;
using Ndns.ServerHost.Abstractions;
using Ndns.ServerHost.Abstractions.Services;
using System;

namespace Ndns.ServerHost.Builder
{
    public static class ConsoleLoggerBuilder
    {
        public static IServiceBuilder AddConsoleLogger(this IServiceBuilder services)
        {
            if (services == null)
                throw new ArgumentNullException(nameof(services));

            services.Add(typeof(ILoggerProvider), new ConsoleLoggerProvider());

            return services;
        }

        public static IServiceBuilder AddConsoleLogger(this IServiceBuilder services, LogLevel minimumLogLevel)
        {
            if (services == null)
                throw new ArgumentNullException(nameof(services));

            services.Add(typeof(ILoggerProvider), new ConsoleLoggerProvider(minimumLogLevel));

            return services;
        }
    }
}
